package com.suray.basic.wcs.plc.utils;


import java.util.Objects;

/**
 * @author shaozn
 */
public class NetAddress {
    private String ip;
    private int port;

    public NetAddress(String ip, int port) {
        this.ip = ip;
        this.port = port;
    }

    public String getIp() {
        return ip;
    }

    public int getPort() {
        return port;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        NetAddress that = (NetAddress) o;
        return port == that.port && Objects.equals(ip, that.ip);
    }

    @Override
    public int hashCode() {

        return Objects.hash(ip, port);
    }

    @Override
    public String toString() {
        return "NetAddress{" + "ip='" + ip + '\'' + ", port=" + port + '}';
    }
}
